<template>
  <Header>
    <div class="hoverIcon user_case d-flex">
      <div class="demo-avatar userInfo mr-3">
        <Avatar style="background-color: #87d068" icon="ios-person" />
      </div>
      <Dropdown class="dropdownbox" @on-click="menuClick">
        <a href="javascript:void(0)" class="name">
          {{ user.name }}
          <Icon type="ios-arrow-down"></Icon>
        </a>
        <DropdownMenu slot="list">
          <DropdownItem name="personalCenter">个人中心</DropdownItem>
          <DropdownItem name="loginOut">退出登录</DropdownItem>
        </DropdownMenu>
      </Dropdown>
    </div>
  </Header>
</template>
<script>
export default {
  data() {
    return {
      isCollapsed: false,
      currentIndex: 0,
      isShow: false,
    };
  },
  computed: {
    rotateIcon() {
      return ["menu-icon", this.isCollapsed ? "rotate-icon" : ""];
    },
    menuitemClasses() {
      return ["menu-item", this.isCollapsed ? "collapsed-menu" : ""];
    },
    user() {
      return this.$store.state.user;
    },
  },
  methods: {
    collapsedSider() {
      this.$refs.side1.toggleCollapse();
    },

    menuClick(name) {
      var self = this;
      if (name == "loginOut") {
        this.$Modal.confirm({
          title: "退出",
          content: "确认退出当前账户么?",
          onOk: function () {
            var VIRTUAL_PATH = process.env.VUE_APP_VIRTUAL_PATH;
            self.$router.push(`${VIRTUAL_PATH}/login?isExit=true`);
          },
        });
      }
    },
    goContent(url) {
      location.href = url;
    },
  },
};
</script>
<style lang="less" scoped>
.ivu-layout-header {
  display: flex;
  height: 60px;
  line-height: 60px;
  background-color: #fff;
  .mini_menu {
    .ivu-icon {
      padding: 0 !important;
    }
    .iconBox {
      float: left;
      width: 20%;
      text-align: center;
      margin: 20px 0;
      img {
        width: 75px;
        height: 75px;
        border-radius: 15px;
        box-shadow: 0 4px 9px rgba(0, 0, 0, 0.25);
      }
      p {
        text-align: center;
      }
    }
  }
  .search {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 1.5rem;
    .headinput {
      margin-right: 1rem;
      margin-left: 1rem;
    }
  }
  .source {
    .notice {
      i {
        vertical-align: middle;
      }
    }
  }
  .user_case {
    margin: 0 2rem;
    .userInfo {
    }
  }
  .hoverIcon:hover {
    background-color: #f8f8fb;
  }
}
</style>
